# Contributor: Patrick Gaskin <patrick@pgaskin.net>
# Maintainer: Patrick Gaskin <patrick@pgaskin.net>
pkgname=scream
pkgver=3.4
pkgrel=1
pkgdesc="client for scream virtual network sound card for Microsoft Windows"
url="http://github.com/duncanthrax/scream"
arch="all"
license="MS-PL"
options="!check" # no test suite provided
makedepends="alsa-lib-dev pulseaudio-dev"
subpackages="$pkgname-alsa $pkgname-alsa-openrc:alsa_openrc:noarch $pkgname-pulse"
source="$pkgname-$pkgver.tar.gz::https://github.com/duncanthrax/scream/archive/3.4.tar.gz
	scream-alsa.initd
	scream-alsa.confd
	"

# Note: Init scripts are only provided for scream-alsa, because pulseaudio is
#       meant to be run per-user, and scream-raw doesn't have any output
#       methods built-in.

build() {
	make -C "$builddir"/Receivers/raw
	make -C "$builddir"/Receivers/alsa
	make -C "$builddir"/Receivers/pulseaudio
}

package() {
	install -Dm755 "$builddir"/Receivers/raw/scream-raw "$pkgdir"/usr/bin/scream-raw
	install -Dm755 "$builddir"/Receivers/alsa/scream-alsa "$pkgdir"/usr/bin/scream-alsa
	install -Dm755 "$builddir"/Receivers/pulseaudio/scream-pulse "$pkgdir"/usr/bin/scream-pulse
}

alsa() {
	pkgdesc="$pkgdesc (ALSA client)"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/scream-alsa "$subpkgdir"/usr/bin/scream-alsa
}

alsa_openrc() {
	# based on default_openrc, but needs to be here because it's for a subpackage
	pkgdesc="$pkgdesc (ALSA client) (OpenRC init scripts)"
	install_if="openrc $pkgname-alsa=$pkgver-r$pkgrel"
	install -Dm755 "$srcdir"/scream-alsa.initd "$subpkgdir"/etc/init.d/scream-alsa
	install -Dm644 "$srcdir"/scream-alsa.confd "$subpkgdir"/etc/conf.d/scream-alsa
}

pulse() {
	pkgdesc="$pkgdesc (PulseAudio client)"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/scream-pulse "$subpkgdir"/usr/bin/scream-pulse
}

sha512sums="7b1ebf8d3e5590631f817c916e43e8319240148ffc80d7d8c92936c5121ea63b60e3cd2bcc9a4f49e0d1c6f93a4bb243322fa5587fd823a704c4ec18b6614ec3  scream-3.4.tar.gz
781ea7e73c253c9f2b6022b448a5f10bd3fbd9650b111e0ae5e68c8610e6bef13dffc113d15f53cb17fd12771247ab4b35ed0f0cb519ed67efd2ffc0d9297914  scream-alsa.initd
46572f29830962c1f3201d5f3716ddbb05f7387a1fd547138bb6bd945f336b35c1a84c68b6d0f9071b994c632ae37c8d271f67541ae99247463dcb88a5186bfa  scream-alsa.confd"
